package com.android.place360.place_search_result;

import android.content.Context;
import android.view.LayoutInflater;
import android.widget.*;
import com.android.place360.R;
public class CustomViewGroup extends LinearLayout {


	private ImageView icon;
	private int iconId;
	private TextView placeName;
	private TextView address;
	private TextView distance;

	public TextView getDistance() {
		return distance;
	}

	public void setDistance(TextView distance) {
		this.distance = distance;
	}

	public TextView getPlaceName() {
		return placeName;
	}

	public void setPlaceName(TextView placeName) {
		this.placeName = placeName;
	}

	public TextView getAddress() {
		return address;
	}

	public void setAddress(TextView address) {
		this.address = address;
	}

	public ImageView getIcon() {
		return icon;
	}

	public void setIcon(ImageView icon) {
		this.icon = icon;
	}

	public int getIconId() {
		return iconId;
	}

	public void setIconId(int iconId) {
		this.iconId = iconId;
	}


	public CustomViewGroup(Context context) {
		super(context);

		//Sử dụng LayoutInflater để gán giao diện trong list.xml cho class này
		LayoutInflater li = (LayoutInflater)this.getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
		li.inflate(R.layout.custom_list_result, this,true);
		
		//Lấy các view qua id
		icon = (ImageView)findViewById(R.id.listResultIcon);		
		placeName = (TextView)findViewById(R.id.listResultPlaceName);
		address = (TextView)findViewById(R.id.listResultAddress);
		distance = (TextView)findViewById(R.id.distance);
		icon.setImageResource(iconId);
		
	}

}
